#!/bin/sh /etc/rc.common

START=99
STOP=10

alias DATE="date '+%A %Y-%m-%d %H:%M:%S'"

start() {
	[ ! -d "/etc/serverchan" ] && mkdir /etc/serverchan
	[ ! -d "/tmp/serverchan" ] && mkdir /tmp/serverchan
	sed -i '/#sccustom detect/d' /etc/crontabs/root
	echo "00 03 * * * /usr/bin/serverchan/sccustom today_cron vacation late #sccustom detect" >> /etc/crontabs/root
	echo "`DATE`：每天凌晨三点检测四点后的节日推送" >> /tmp/serverchan/custom.log
	echo "10 23 * * * /usr/bin/serverchan/sccustom today_cron vacation early #sccustom detect" >> /etc/crontabs/root
	echo "`DATE`：每天凌晨三点检测四点前的节日推送" >> /tmp/serverchan/custom.log
	echo "10 03 * * * /usr/bin/serverchan/sccustom today_cron birthday late #sccustom detect" >> /etc/crontabs/root
	echo "`DATE`：每天凌晨三点十分检测四点后的生日推送" >> /tmp/serverchan/custom.log
	echo "10 23 * * * /usr/bin/serverchan/sccustom today_cron birthday early #sccustom detect" >> /etc/crontabs/root
	echo "`DATE`：每天凌晨二十三点十分检测四点前的生日推送" >> /tmp/serverchan/custom.log
	
	/etc/init.d/sccustom enable
	/usr/bin/serverchan/sccustom daliy_life
}

stop(){
	echo "`DATE`：serverchan自定义推送重新加载" >> /tmp/serverchan/custom.log
}